home *** CD-ROM | disk | FTP | other *** search
/ 64'er Special 4 / 64er_Magazin_Sonderheft_04_86-04_1986_Markt__Technik_de_Disk_1_of_2_Side_A.d64 / parser 4.0 (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  4KB  |  130 lines

  1. 10 open1,8,3,"wortschatz":open15,8,15:rem wortschatz-datei oeffnen
  2. 20 data1,3,0,28,31,47,51,60,68,0,70,76,0,82,90,93,100,101,116,149,155,158
  3. 30 data178,0,0,189
  4. 35 data198 :rem buchstabe nach z !?!
  5. 40 dimin(26):fori=0to26:readin(i):nexti
  6. 50 gosub50000
  7. 60 print"sn="sn:print"ve="ve:print"o1="o1:print"o2="o2:print"ud="ud:print"ri="ri
  8. 70 print"ad="ad:print:goto50
  9. 50000 rem *****************************
  10. 50001 rem *                           *
  11. 50002 rem *     wort-parser 4.0       *
  12. 50003 rem *                           *
  13. 50004 rem *      <c> 1986 bei         *
  14. 50005 rem *                           *
  15. 50006 rem *     michael nickles       *
  16. 50007 rem *                           *
  17. 50008 rem *****************************
  18. 50010 rem befehlssatzeingabe ---------------------------------------------------
  19. 50011 :
  20. 50012 ifud>0then50500:rem und
  21. 50015 sl=80: rem befehlssatzlaenge
  22. 50020 print"":be$="":poke198,0:poke211,0:poke214,22:sys58732:print"[158][164]";
  23. 50030 getx$:ifpeek(203)=1then50120
  24. 50040 ifx$=""then50030
  25. 50050 iflen(be$)=0andasc(x$)=20then50030
  26. 50060 i=asc(x$):ifi<32ori>133andi<159thenifi<>20then50030
  27. 50070 iflen(be$)=slandi<>20then50030
  28. 50080 be$=be$+x$
  29. 50090 printchr$(20);x$;"[164]";
  30. 50100 ifi=20thenbe$=left$(be$,len(be$)-2):goto50030
  31. 50110 goto50030
  32. 50120 print"[157] "
  33. 50400 rem satzzeichen suchen ---------------------------------------------------
  34. 50401 :
  35. 50415 sn=0
  36. 50420 ifright$(be$,1)=" "thenbe$=left$(be$,len(be$)-1):goto50420
  37. 50430 i$=right$(be$,1)
  38. 50440 ifi$="."ori$="!"thensn=0:be$=left$(be$,len(be$)-1):goto50420
  39. 50450 ifi$="?"thensn=1:be$=left$(be$,len(be$)-1):goto50420
  40. 50500 rem be$-zeiger setzen ----------------------------------------------------
  41. 50501 :
  42. 50502 ifud=0thenve=0:ri=0:o1=0:o2=0
  43. 50504 ifud>0thenri=0:goto50530
  44. 50505 ifleft$(be$,1)=" "thenbe$=right$(be$,len(be$)-1):goto50505
  45. 50510 be$=be$+" "
  46. 50520 za=1 :rem zeiger a setzen
  47. 50530 zb=za+1
  48. 50540 ifmid$(be$,zb,1)=""thenud=0:return
  49. 50550 ifmid$(be$,zb,1)<>" "thenzb=zb+1:goto50550
  50. 50590 su$=mid$(be$,za,zb-za)
  51. 50600 rem su$ vorbehandlung ----------------------------------------------------
  52. 50601 :
  53. 50610 ifsu$="und"thenud=1:goto50630
  54. 50620 ifsu$=","thenud=2:goto50630
  55. 50625 goto50670
  56. 50630 za=zb+1
  57. 50640 ifmid$(be$,za,1)=""thenprint"[213]nd was ?":goto50530
  58. 50650 ifmid$(be$,za,1)=" "thenza=za+1:goto50650
  59. 50660 return
  60. 50670 ifsu$="ihn"orsu$="sie"orsu$="es"theno1=om:goto51300
  61. 51000 rem binaere suchroutine --------------------------------------------------
  62. 51001 :
  63. 51007 rem anfang und ende des suchbereiches ermitteln
  64. 51008 i=asc(left$(su$,1))
  65. 51009 ifi-65<0ori-65>25thengosub51500:goto50000
  66. 51010 an=in(i-65):rem anfang des suchbereiches
  67. 51012 iz=64
  68. 51013 ifin(i-iz)=0theniz=iz-1:goto51013
  69. 51015 en=in(i-iz)-1:rem ende des suchbereiches
  70. 51016 ifan=0thengosub51500:ud=0:goto50000
  71. 51020 sz=197:n=int(log(en-an+1)/log(2))+1              :rem maximal-formel
  72. 51030 sa=an-1+(2^n)/2:rem mitte der ges.dat
  73. 51040 gosub52100:rem a$ lesen
  74. 51050 n=n-1     :rem 1.abfrage
  75. 51060 :
  76. 51070 rem su$ mit a$ vergleichen ------
  77. 51080 : iflen(su$)<3then51110
  78. 51090 : ifwa=1 and su$=left$(a$,len(su$)) thenve=wc:goto51300
  79. 51100 : ifwa<>3orsu$<>right$(a$,len(su$))then51110
  80. 51102 :  ifud=1orud=2thenud=3:o1=0:o2=0
  81. 51104 :   ifo1=0theno1=wc:om=o1:goto51300
  82. 51105 :   ifo2=0theno2=wc:om=o1:goto51300
  83. 51110 : ifwa=2 and su$=a$                 thenri=wc:goto51300
  84. 51115 : ifwa=5 and su$=a$                 thenad=wc:goto51300
  85. 51120 : ifwa=1 and su$=a$                 thenve=wc:goto51300
  86. 51125 : ifwa=4 and su$=a$                 then51300
  87. 51130 : ifsu$<a$thensa=sa-(2^(n-1)):gosub52100:goto51160
  88. 51140 : ifsa+(2^(n-1))>sa+en-anandn>-1thenn=n-1:goto51140:rem ''ueberlauf''
  89. 51150 : sa=sa+(2^(n-1)):gosub52100:rem ''halbieren''
  90. 51160 :
  91. 51170 :n=n-1    :rem naechst. halbieren
  92. 51180 :ifn<0thengosub51500:ud=0:goto50000
  93. 51190 rem print"sa=";sa;" n=";n                             :rem unnoetig !!
  94. 51200 :goto51060:rem naechst. such-vers.
  95. 51300 rem naechstes wort
  96. 51310 za=zb+1
  97. 51320 ifmid$(be$,za,1)=""then50530
  98. 51330 ifmid$(be$,za,1)=" "thenza=za+1:goto51330
  99. 51350 goto50530
  100. 51500 rem ich kenne su$ nicht --------------------------------------------------
  101. 51501 :
  102. 51510 i=int(3*rnd(1))+1
  103. 51520 onigoto51530,51540,51550
  104. 51530 x$=""+"ich kenne das wort '"+su$+"' nicht.":goto52000
  105. 51540 x$=""+"das wort '"+su$+"' ist mir nicht bekannt.":goto52000
  106. 51550 x$=""+"deutsch ist leider nur meine zweite sprache. ich kenne das "
  107. 51555 x$=x$+"wort '"+su$+"' nicht.":goto52000
  108. 52000 rem formatierte textausgabe ----------------------------------------------
  109. 52010 ifx$=""then52090
  110. 52020 iflen(x$)<40thenprintx$:goto52090
  111. 52030 iflen(x$)=40thenprintx$;:goto52090
  112. 52040 i$=left$(x$,41):ic=0:fori=1tolen(i$):ifmid$(i$,i,1)=" "thenic=i
  113. 52050 nexti:ific=0thenprintx$:goto52090
  114. 52060 i$=left$(i$,ic-1):iflen(i$)=40thenprinti$;
  115. 52070 iflen(i$)<40thenprinti$
  116. 52080 x$=right$(x$,len(x$)-ic):goto52010
  117. 52090 return
  118. 52100 rem satz-teilbereich lesen -----------------------------------------------
  119. 52101 :
  120. 52110 hb%=sa/256:lb%=sa-hb%*256
  121. 52112 print#15,"p";chr$(3);chr$(lb%);chr$(hb%);chr$(1)
  122. 52114 input#15,a:ifa=50thenprint"satznummer zu hoch"
  123. 52120 ifa=50thenreturn
  124. 52130 input#1,a$
  125. 52140 wa=val(mid$(a$,22,1))
  126. 52150 wc=val(mid$(a$,23,3))
  127. 52160 a$=left$(a$,21)
  128. 52170 ifright$(a$,1)=""thena$=left$(a$,len(a$)-1):goto52170
  129. 52180 return
  130.